//
//  UIAlertView+Data.m
//  Car4S
//
//  Created by William Zheng on 13-5-21.
//
//

#import <objc/runtime.h>
#import "UIAlertView+Data.h"

static char *const kAssociateKey = "alertKey";

@implementation UIAlertView (Data)
- (void)setObject:(id)object forKey:(NSString *)key{
    NSMutableDictionary *dict = objc_getAssociatedObject(self, kAssociateKey);
    if (!dict) {
        dict = [NSMutableDictionary dictionary];
        objc_setAssociatedObject(self, kAssociateKey, dict, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
    }
    [dict setObject:object forKey:key];
}
- (id)objectForKey:(NSString *)key{
    NSMutableDictionary *dict = objc_getAssociatedObject(self, kAssociateKey);
    return [dict objectForKey:key];
}
@end
